<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/stream/SocketIoBuffer.cpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_090521d29e73b40f7fc0a63254d8965e.html">stream</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">SocketIoBuffer.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_socket_io_buffer_8cpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_socket_io_buffer_8h.html">SocketIoBuffer.h</a>&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160; </div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#ifdef STD11</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<a class="code" href="class_c_socket_io_buffer.html#a1c62dd42c23ffb8c1d2c8dedb6421e48">CSocketIoBuffer::CSocketIoBuffer</a>(<a class="code" href="class_c_socket_io_buffer.html">CSocketIoBuffer</a>&amp;&amp; iobuf):<a class="code" href="class_c_stream_buffer.html">CStreamBuffer</a>()</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;{</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;    *<span class="keyword">this</span> = std::move(iobuf);</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;}</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<a class="code" href="class_c_socket_io_buffer.html">CSocketIoBuffer</a>&amp; <a class="code" href="class_c_stream_buffer.html#ae4d72e489f374e26b874025b5d88a6f4">CSocketIoBuffer::operator= </a>(<a class="code" href="class_c_socket_io_buffer.html">CSocketIoBuffer</a>&amp;&amp; iobuf)</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <span class="keywordflow">if</span> (<span class="keyword">this</span> != &amp;iobuf)</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    {</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;        <a class="code" href="class_c_stream_buffer.html#a3b39de36fc32da3c0d02bd1f2d032034">clear</a>();</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;        std::swap(this-&gt;<a class="code" href="class_c_stream_buffer.html#ad7cf1ca44456ef1435250109cee1bee5">_max</a>, iobuf._max);</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;        std::swap(this-&gt;<a class="code" href="class_c_stream_buffer.html#a101b52acd1aa627d6c5b1c5142e83731">_data</a>, iobuf._data);</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;        std::swap(this-&gt;<a class="code" href="class_c_stream_buffer.html#a5401559e6e6a78fd0a7f6613368ac2b0">_size</a>, iobuf._size);</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    }</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;}</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#endif //STD11</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="class_c_socket_io_buffer.html#a0834b50d2414330fcbda36ca2fadd293">   25</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_socket_io_buffer.html#a0834b50d2414330fcbda36ca2fadd293">CSocketIoBuffer::swap</a>(<a class="code" href="class_c_socket_io_buffer.html">CSocketIoBuffer</a>&amp; iobuf)</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <a class="code" href="class_c_stream_buffer.html#ad1801dff132d9c876d827510d457eedc">CStreamBuffer::swap</a>(iobuf);</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;}</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_c_socket_io_buffer.html#a1c62dd42c23ffb8c1d2c8dedb6421e48">   30</a></span>&#160;<a class="code" href="class_c_socket_io_buffer.html#a1c62dd42c23ffb8c1d2c8dedb6421e48">CSocketIoBuffer::CSocketIoBuffer</a>()</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;{</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;}</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="class_c_socket_io_buffer.html#a4be29cc364e95fcc18bdca2727e03f20">   34</a></span>&#160;<a class="code" href="class_c_socket_io_buffer.html#a1c62dd42c23ffb8c1d2c8dedb6421e48">CSocketIoBuffer::CSocketIoBuffer</a>(<span class="keywordtype">size_t</span> size) :<a class="code" href="class_c_stream_buffer.html">CStreamBuffer</a>(size)</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;{</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;}</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="class_c_socket_io_buffer.html#a105cbfb8869aa001ca379367f307712a">   38</a></span>&#160;<a class="code" href="class_c_socket_io_buffer.html#a105cbfb8869aa001ca379367f307712a">CSocketIoBuffer::~CSocketIoBuffer</a>()</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;{</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;}</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="class_c_socket_io_buffer.html#af19bee2e2dd9c3e21e78cc68d7d06312">   43</a></span>&#160;<span class="keywordtype">size_t</span> <a class="code" href="class_c_socket_io_buffer.html#af19bee2e2dd9c3e21e78cc68d7d06312">CSocketIoBuffer::copy_str</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str, <span class="keywordtype">size_t</span> size <span class="comment">/* = 0 */</span>)</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="class_c_stream_buffer.html#aa142871df4960e4d17167f56de651469">size</a> == 0) <a class="code" href="class_c_stream_buffer.html#aa142871df4960e4d17167f56de651469">size</a> = strlen(str);</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    this-&gt;<a class="code" href="class_c_stream_buffer.html#a805cc466a664d1f533d1c8617bc49f36">copy_mem</a>(str, <a class="code" href="class_c_stream_buffer.html#aa142871df4960e4d17167f56de651469">size</a>);</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_stream_buffer.html#a5401559e6e6a78fd0a7f6613368ac2b0">_size</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;}</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclass_c_stream_buffer_html_a5401559e6e6a78fd0a7f6613368ac2b0"><div class="ttname"><a href="class_c_stream_buffer.html#a5401559e6e6a78fd0a7f6613368ac2b0">CStreamBuffer::_size</a></div><div class="ttdeci">size_t _size</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8h_source.html#l00093">StreamByte.h:93</a></div></div>
<div class="ttc" id="aclass_c_socket_io_buffer_html_a0834b50d2414330fcbda36ca2fadd293"><div class="ttname"><a href="class_c_socket_io_buffer.html#a0834b50d2414330fcbda36ca2fadd293">CSocketIoBuffer::swap</a></div><div class="ttdeci">virtual void swap(CSocketIoBuffer &amp;iobuf)</div><div class="ttdef"><b>Definition:</b> <a href="_socket_io_buffer_8cpp_source.html#l00025">SocketIoBuffer.cpp:25</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_a3b39de36fc32da3c0d02bd1f2d032034"><div class="ttname"><a href="class_c_stream_buffer.html#a3b39de36fc32da3c0d02bd1f2d032034">CStreamBuffer::clear</a></div><div class="ttdeci">virtual void clear()</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00067">StreamByte.cpp:67</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_ad1801dff132d9c876d827510d457eedc"><div class="ttname"><a href="class_c_stream_buffer.html#ad1801dff132d9c876d827510d457eedc">CStreamBuffer::swap</a></div><div class="ttdeci">virtual void swap(CStreamBuffer &amp;st)</div><div class="ttdoc">交换两者内存</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00169">StreamByte.cpp:169</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_aa142871df4960e4d17167f56de651469"><div class="ttname"><a href="class_c_stream_buffer.html#aa142871df4960e4d17167f56de651469">CStreamBuffer::size</a></div><div class="ttdeci">virtual size_t size() const</div><div class="ttdoc">返回缓存大小</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00130">StreamByte.cpp:130</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_ae4d72e489f374e26b874025b5d88a6f4"><div class="ttname"><a href="class_c_stream_buffer.html#ae4d72e489f374e26b874025b5d88a6f4">CStreamBuffer::operator=</a></div><div class="ttdeci">CStreamBuffer &amp; operator=(const CStreamBuffer &amp;st)</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00146">StreamByte.cpp:146</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="aclass_c_socket_io_buffer_html_af19bee2e2dd9c3e21e78cc68d7d06312"><div class="ttname"><a href="class_c_socket_io_buffer.html#af19bee2e2dd9c3e21e78cc68d7d06312">CSocketIoBuffer::copy_str</a></div><div class="ttdeci">size_t copy_str(const char *str, size_t size=0)</div><div class="ttdoc">拷贝固定长度大小内存</div><div class="ttdef"><b>Definition:</b> <a href="_socket_io_buffer_8cpp_source.html#l00043">SocketIoBuffer.cpp:43</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html"><div class="ttname"><a href="class_c_stream_buffer.html">CStreamBuffer</a></div><div class="ttdoc">buffer类</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8h_source.html#l00040">StreamByte.h:40</a></div></div>
<div class="ttc" id="aclass_c_socket_io_buffer_html"><div class="ttname"><a href="class_c_socket_io_buffer.html">CSocketIoBuffer</a></div><div class="ttdoc">套接字buffer类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_io_buffer_8h_source.html#l00013">SocketIoBuffer.h:13</a></div></div>
<div class="ttc" id="aclass_c_socket_io_buffer_html_a105cbfb8869aa001ca379367f307712a"><div class="ttname"><a href="class_c_socket_io_buffer.html#a105cbfb8869aa001ca379367f307712a">CSocketIoBuffer::~CSocketIoBuffer</a></div><div class="ttdeci">virtual ~CSocketIoBuffer()</div><div class="ttdef"><b>Definition:</b> <a href="_socket_io_buffer_8cpp_source.html#l00038">SocketIoBuffer.cpp:38</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_a805cc466a664d1f533d1c8617bc49f36"><div class="ttname"><a href="class_c_stream_buffer.html#a805cc466a664d1f533d1c8617bc49f36">CStreamBuffer::copy_mem</a></div><div class="ttdeci">virtual const void * copy_mem(const void *dst, size_t size)</div><div class="ttdoc">拷贝固定长度大小内存</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00176">StreamByte.cpp:176</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_a101b52acd1aa627d6c5b1c5142e83731"><div class="ttname"><a href="class_c_stream_buffer.html#a101b52acd1aa627d6c5b1c5142e83731">CStreamBuffer::_data</a></div><div class="ttdeci">char * _data</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8h_source.html#l00092">StreamByte.h:92</a></div></div>
<div class="ttc" id="a_socket_io_buffer_8h_html"><div class="ttname"><a href="_socket_io_buffer_8h.html">SocketIoBuffer.h</a></div></div>
<div class="ttc" id="aclass_c_socket_io_buffer_html_a1c62dd42c23ffb8c1d2c8dedb6421e48"><div class="ttname"><a href="class_c_socket_io_buffer.html#a1c62dd42c23ffb8c1d2c8dedb6421e48">CSocketIoBuffer::CSocketIoBuffer</a></div><div class="ttdeci">CSocketIoBuffer()</div><div class="ttdoc">构造一个空buffer</div><div class="ttdef"><b>Definition:</b> <a href="_socket_io_buffer_8cpp_source.html#l00030">SocketIoBuffer.cpp:30</a></div></div>
<div class="ttc" id="aclass_c_stream_buffer_html_ad7cf1ca44456ef1435250109cee1bee5"><div class="ttname"><a href="class_c_stream_buffer.html#ad7cf1ca44456ef1435250109cee1bee5">CStreamBuffer::_max</a></div><div class="ttdeci">size_t _max</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8h_source.html#l00094">StreamByte.h:94</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
